﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Deixei.Domain.Service;
using Deixei.Web.Controllers;

namespace Deixei.MvcApplication.Controllers
{
    public class ValuesController : DeixeiApiController
    {
        private readonly IValuesService _valuesService;

        public ValuesController()
        {
            _valuesService = new ValuesService();
        }
        public ValuesController(IValuesService valuesService)
        {
            _valuesService = valuesService;
        } 

        // GET api/<controller>
        public IEnumerable<KeyValuePair<int, string>> Get()
        {
            return _valuesService.GetAll(); 
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            return _valuesService.Get(id); 
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
            _valuesService.Create(value); 
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
            _valuesService.Update(id, value); 
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
            _valuesService.Delete(id); 
        }
    }
}